package com.example;

import com.example.service.UserService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Aop {
    public static void main(String[] args) {
        // 创建 Spring 容器
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");

        // 获取 UserService Bean
        UserService userService = (UserService) context.getBean("userService");

        // 调用方法进行测试
        System.out.println(userService.getUserInfo("123"));
        System.out.println(userService.getUserInfoWithException("error"));
    }
}
